package com.example.tellwin.home.act;

import android.os.Bundle;
import android.widget.TextView;

import com.example.tellwin.R;
import com.example.tellwin.base.CpBaseActivty;
import com.example.tellwin.common.Common;
import com.example.tellwin.home.bean.ActivityDetailContentBean;
import com.example.tellwin.utils.CommonUtils;
import com.example.tellwin.view.ContentTextView;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ActIntroductionActivity extends CpBaseActivty {

    @BindView(R.id.participator_ctv)
    ContentTextView participatorCtv;
    @BindView(R.id.now_number_of_participants_ctv)
    ContentTextView nowNumberOfParticipantsCtv;
    @BindView(R.id.number_of_participants_ctv)
    ContentTextView numberOfParticipantsCtv;
    @BindView(R.id.active_work_form_ctv)
    ContentTextView activeWorkFormCtv;
    @BindView(R.id.active_prize_ctv)
    ContentTextView activePrizeCtv;
    @BindView(R.id.prize_give_way_ctv)
    ContentTextView prizeGiveWayCtv;
    @BindView(R.id.prize_number_ctv)
    ContentTextView prizeNumberCtv;
    @BindView(R.id.deadline_ctv)
    ContentTextView deadlineCtv;
    @BindView(R.id.act_introduction_tv)
    TextView actIntroductionTv;

    ActivityDetailContentBean activityDetailContentBean;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_act_introduction);
        ButterKnife.bind(this);
        initViews();
        initEvents();
        initDatas();
    }

    @Override
    protected void initViews() {

    }

    @Override
    protected void initEvents() {

    }

    @Override
    protected void initDatas() {
        setTitle(R.string.act_introduction);
        activityDetailContentBean = (ActivityDetailContentBean) getIntent().getSerializableExtra(Common.ACTIVITY);
        setActityDetailData(activityDetailContentBean.getActivityDetails());
    }

    private void setActityDetailData(ActivityDetailContentBean.ActivityDetailsBean activityDetailsBean) {
        participatorCtv.setTvStr(CommonUtils.getParticipateStr(activityDetailsBean.getParticipateType()));
        //TODO
        nowNumberOfParticipantsCtv.setTvStr(activityDetailContentBean.getParticipateCount()+ "");
        numberOfParticipantsCtv.setTvStr(activityDetailsBean.getParticipantsNum() + "");
        activeWorkFormCtv.setTvStr(CommonUtils.getParticipateCondition(activityDetailsBean.getParticipateCondition()));
        activePrizeCtv.setTvStr(activityDetailsBean.getActivityPrize());
        prizeGiveWayCtv.setTvStr(activityDetailsBean.getGiveMode());
        prizeNumberCtv.setTvStr(activityDetailsBean.getAwardsCount() + "");

        deadlineCtv.setTvStr(activityDetailsBean.getVoteTime());
        actIntroductionTv.setText(activityDetailsBean.getActivityIntroduce());
    }
}
